perf(tree): speed up and harden workspace repo discovery#217
perf(tree): speed up and harden workspace repo discovery#217bingran-you wants to merge 3 commits intomainfrom
Conversation
- readdirSync uses withFileTypes to drop the per-entry statSync round-trip - skip symlinks explicitly to prevent recursion cycles through shared dirs - expand IGNORED_DIRS (target, vendor, __pycache__, .gradle, .idea, .vscode, coverage, out, .cache, .pytest_cache) so large monorepos prune more aggressively and avoid misclassifying vendored folders - normalize the TREE_SUBMODULES_DIR prefix to forward-slash so the .gitmodules filter works on Windows where join() yields backslashes - warn when a .gitmodules entry points at an uninitialized submodule instead of silently dropping it - pin localeCompare to the "en" locale so sort order is stable across CI runners with differing system locales
|
Breeze pickup test (2026-04-20T22:56:53Z): @bingran-you could you review this? |
|
This reply was drafted by breeze, an autonomous agent running on behalf of the account owner. I reviewed the diff locally and did not find blocking issues; the targeted workspace and inspect tests passed. GitHub does not allow this account to approve its own PR, so another reviewer is needed for a formal approval. |
serenakeyitan
left a comment
There was a problem hiding this comment.
This reply was drafted by breeze, an autonomous agent running on behalf of the account owner. I found one portability concern before I would approve.
|
This reply was drafted by breeze, an autonomous agent running on behalf of the account owner. Addressed the portability concern in |
serenakeyitan
left a comment
There was a problem hiding this comment.
This reply was drafted by breeze, an autonomous agent running on behalf of the account owner. I rechecked the unknown-d_type fallback in src/products/tree/engine/workspace.ts and the new coverage in tests/tree/workspace.test.ts; no blocking issues remain.
Summary
Low-risk optimizations in
discoverWorkspaceReposandparseGitmodules, surfaced while reviewing the submodule-related flow infirst-tree tree bind/tree workspace sync.statSyncround-trip:readdirSyncnow useswithFileTypes: trueand we readisDirectory/isSymbolicLinkoff theDirent..Trash-style shortcuts) cannot senddiscoverNestedReposinto a loop.IGNORED_DIRSwithtarget,vendor,__pycache__,.gradle,.idea,.vscode,coverage,out,.cache,.pytest_cache— prunes more aggressively in polyglot monorepos and reduces the chance of vendored sample repos being picked up as workspace members.TREE_SUBMODULES_DIRprefix check to forward slashes.TREE_SUBMODULES_DIRcomes frompath.joinwhich emits backslashes on Windows, while.gitmodulesentries are always forward-slash — the previousstartsWithcheck silently failed there..gitmodulesdeclares a submodule that is not initialized (repo.isGitRepo()returns false). Previouslyworkspace syncwould silently drop it and leave the user wondering why N−1 repos were bound.localeCompareto"en"so output order is deterministic across CI runners with differing system locales.No public API changes.
WorkspaceRepoKindandWorkspaceRepoCandidateshapes are untouched.Test plan
pnpm typecheckpnpm validate:skillpnpm test— all tree / e2e / CLI suites green. One pre-existing breeze-daemon-runner failure reproduces on untouchedHEADand is unrelated.tests/e2e/cli-e2e.test.ts— the workspace-discovery e2e path passes.